<?xml version="1.0" encoding="utf-8" ?>
<workflow.netreport>
	<version number="1.9"/>
	<operatortypes>
		<operatortype name="greaterthan">
			<display>
				<![CDATA[>]]>
			</display>
			<dbvalue>
				<![CDATA[>]]>
			</dbvalue>
		</operatortype>
		<operatortype name="lessthan">
			<display>
				<![CDATA[<]]>
			</display>
			<dbvalue>
				<![CDATA[<]]>
			</dbvalue>
		</operatortype>
		<operatortype name="greaterthanandequalto">
			<display>
				<![CDATA[>=]]>
			</display>
			<dbvalue>
				<![CDATA[>=]]>
			</dbvalue>
		</operatortype>
		<operatortype name="lessthanandequalto">
			<display>
				<![CDATA[<=]]>
			</display>
			<dbvalue>
				<![CDATA[<=]]>
			</dbvalue>
		</operatortype>
		<operatortype name="in">
			<display>
				<![CDATA[In]]>
			</display>
			<dbvalue>
				<![CDATA[in]]>
			</dbvalue>
		</operatortype>
		<operatortype name="contains">
			<display>
				<![CDATA[Contains]]>
			</display>
			<dbvalue>
				<![CDATA[Like]]>
			</dbvalue>
		</operatortype>
		<operatortype name="notin">
			<display>
				<![CDATA[Not In]]>
			</display>
			<dbvalue>
				<![CDATA[not in]]>
			</dbvalue>
		</operatortype>
		<operatortype name="notequalto">
			<display>
				<![CDATA[<>]]>
			</display>
			<dbvalue>
				<![CDATA[<>]]>
			</dbvalue>
		</operatortype>
		<operatortype name="equalto">
			<display>
				<![CDATA[=]]>
			</display>
			<dbvalue>
				<![CDATA[=]]>
			</dbvalue>
		</operatortype>
	</operatortypes>
	<!-- Columns for the display -->
	<outputfields>
		<!--
			outputfields are used to identify  the database fields on which the search has to be performed ,
			Inner groups identified in the groups are identified  as tree structured levels for displaly.
			The name provided for a column is mapped with the queryfield in queryfields to identify on which field the search has to be done.
			Type is used to identify how to display or retrieve the value (for example if the type is resource then 
			the virtualid has to be passsed and the name has to be retrieved for the resource collection,if its datetime then 
			it has to be written in client date etc.)
			Query is used to built the query,search will be performed on value tagged as query 
				(Ex: search on categroy mapped as WorkflowName wil be built as SWE.Name='WF')
			Queryas tag is provided to avoid ambiguity caused by same field names.
			Displayas tag is used to display the particular field as header in the UI
			Display tag is used to check whether the field has to be displayed in the UI
		-->
		<groupby name="Workflow">
			<columns width="100%">
				<!--If queryas attribute is null then that particuler field is not included in the query-->
				<column name="Application"	  type="string"	   query="SWE.Application"	  queryas="Application" displayas="Application" display="true" displaywidth="20%"></column>
				<column name="WorkflowName"	  type="string"	   query="SWE.Name"		  queryas="Workflow" displayas="Workflow" display="true" displaywidth="15%"></column>
				<column name="VirtualUserid"  	  type="resource"  query="SWE.VirtualUserid"  	  queryas="SubmittedBy" displayas="Submitted By" display="true" displaywidth="15%"></column>
				<column name="InternalStatus" 	  type="string"    query="SWE.InternalStatus" 	  queryas="InternalStatus" displayas="InternalStatus" display="true" displaywidth="15%" mapvaluetoqueryfield="Workflow Internal Status" maptofieldinqueryfield="Status"></column>
				<column name="Status"		  type="string"	   query="SWE.Status"		  queryas="WorkflowUserStatus" displayas="" display="false" displaywidth=""></column>
				<column name="CharData"		  type="string"	   query="SWL.CharData"		  queryas="" displayas="" display="false" displaywidth=""></column>
				<column name="Version"		  type="int"	   query="SWP.Version"	   conditionbuilder="subquery" queryas="Version" displayas="Version" display="true" displaywidth="5%" >
					<subquery name="subquery1" value="0" operator="userset">
						<query name="filtercondition" type="subquery">
							<!--
								The sub query option is provided, if the search query cannot be built on a particular db field.
								The positions that can be provided are "fields" or "end".
								The queryname will always be filtercondition.
							-->
							<add action="append" position="fields">
								<![CDATA[ SWP.Version <bookmark name="replaceoperator"/>]]>
							</add>
							<add action="replace" position="replaceoperator" type="bookmark">
								<value selectvalue="Operator" format="operator"/>
							</add>
							<add action="append" position="fields">
								<datasource type="default">
									<![CDATA[ (SELECT Isnull(Max(Version),0) as Version FROM SWProduction]]>
								</datasource>
								<datasource type="sql server">
									<![CDATA[ (SELECT Isnull(Max(Version),0) as Version FROM SWProduction]]>
								</datasource>
								<datasource type="oracle oledb">
									<![CDATA[ (SELECT NVL(Max(Version),0) as Version FROM SWProduction ]]>									
								</datasource>
							</add>
							<!--Where condition is given inside add tag, because subquery doesnt support child queries-->
							<add action="append" position="fields" >
								<![CDATA[ WHERE Application = SWE.Application ]]>								
							</add>
							<add action="append" position="fields" >
								<![CDATA[ AND Name = SWE.Name]]>
							</add>							
							<add action="append" position="fields" >
								<![CDATA[ )]]>
							</add>
						</query>
					</subquery>
					<!--If value is set as userset then , This subquery will be evaluvated against the operator to fetch the query for search , also the Version (column name) will be available  in the value collection for the value entered by user-->
					<!--If operator is set as userset, Then the operator will be passed to the value collection as Operator-->
					<!--type attribute is used to distinquish between parent query and child query-->
					<subquery name="subquery2" value="userset" operator="userset">					
						<query name="filtercondition" type="subquery">
							<add action="append" position="fields">
								<![CDATA[ SWP.Version <bookmark name="replaceoperator"/>]]>
							</add>
							<add action="replace" position="replaceoperator" type="bookmark">
								<value selectvalue="Operator" format="operator"/>
							</add>
							<add action="append" position="fields" >
								<value selectvalue="Version" format="int"/>
							</add>							
						</query>
					</subquery>
				</column>
				<column name="ExecutionId"	  type="string"	   query="SWE.Id "		  queryas="ExecutionId" displayas="ExecutionId" display="false" displaywidth="5%"></column>
				<column name="RequestedOn"	  type="datetime"  query="SWE.RequestedOn" conditionbuilder="subquery" 	  queryas="SubmittedDateTime" displayas="Executed Date Time" display="true" displaywidth="true" width="25%">
					<!--If value is set as userset then , This subquery will be evaluvated against the operator to fetch the query for search , also the RequestedOn (column name) will be available  in the value collection for the value entered by user-->
					<!--If operator is set as userset, Then the operator will be passed to the value collection as Operator-->
					<!--type attribute is used to distinquish between parent query and child query-->
					<subquery name="subquery1" value="userset" operator="userset">
						<query name="filtercondition" type="subquery">
							<!--
								The sub query option is provided, if the search query cannot be built on a particular db field.
								The positions that can be provided are "fields" or "end".
								The queryname will always be filtercondition.
							-->
							<add action="append" position="fields">
								<datasource type="Default">
									<![CDATA[ dateDiff(dd,]]>
									<value selectvalue="RequestedOn" format="datetime"/>
								</datasource>
								<datasource type="sql server">
									<![CDATA[ dateDiff(dd,]]>
									<value selectvalue="RequestedOn" format="datetime"/>
								</datasource>
								<datasource type="oracle oledb">
									<![CDATA[ trunc(SWE.RequestedOn+(]]>
									<value selectvalue="datecorrectionfactor" format="timespaninminutes"/>
								</datasource>
								<datasource type="access oledb">
									<![CDATA[ dateDiff("d",]]>
									<value selectvalue="RequestedOn" format="datetime"/>
								</datasource>
							</add>							
							<add action="append" position="fields">
								<datasource type="Default">
									<![CDATA[ ,dateadd(mi,]]>
									<value selectvalue="datecorrectionfactor" format="timespaninminutes"/>
								</datasource>
								<datasource type="sql server">
									<![CDATA[ ,dateadd(mi,]]>
									<value selectvalue="datecorrectionfactor" format="timespaninminutes"/>
								</datasource>
								<datasource type="oracle oledb">
									<![CDATA[ /60)/24) <bookmark name="replaceoperator"/> trunc(TO_DATE(TO_CHAR( ]]>
									<value selectvalue="RequestedOn" format="datetime"/>
								</datasource>
								<datasource type="access oledb">
									<![CDATA[ ,dateadd("n",]]>
									<value selectvalue="datecorrectionfactor" format="timespaninminutes"/>
								</datasource>
							</add>							
							<add action="append" position="fields">
								<datasource type="Default">
									<![CDATA[ ,SWE.RequestedOn)) <bookmark name="replaceoperator"/>  0 ]]>
								</datasource>
								<datasource type="sql server">
									<![CDATA[ ,SWE.RequestedOn)) <bookmark name="replaceoperator"/>  0 ]]>
								</datasource>
								<datasource type="oracle oledb">
									<![CDATA[ ,'MM/DD/YYYY'),'MM/DD/YYYY')) ]]>
								</datasource>								
							</add>
							<add action="replace" position="replaceoperator" type="bookmark">
								<value selectvalue="Operator" format="operator"/>
							</add>							
						</query>
					</subquery>
				</column>
			</columns>
			<breakonfield fieldname="ExecutionId"/>
			<query name="outputquery" >
				<!-- The select query for all report levels is built from the fields collection -->
				<add action="append" position="select">
					<![CDATA[ DISTINCT SWE.Id ]]>
				</add>
				<add action="append" position="from">
					<datasource type="default">
						<![CDATA[ SWProduction SWP With (nolock),SWLong SWL With (nolock),
							(((((SWExecute SWE With (nolock) LEFT OUTER JOIN SWExecutionDetails SWED With (nolock) On SWE.ID = SWED.ExecutionID)
							LEFT OUTER JOIN SWActivityList SWA With (nolock) On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
							LEFT OUTER JOIN SWActivityTransaction SWAT With (nolock) On SWA.ID = SWAT.ActivityId AND SWAT.ExecutionDetailsId=SWA.ExecutionDetailsId AND SWAT.ActivityStatus not in ('awaiting','acknowledged','completed','information') AND SWAT.ActivityStatus is not null)
							LEFT OUTER JOIN SWAcknowledgeDetails SWAD With (nolock) On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId)
							LEFT OUTER JOIN SWActivityCustomFields SWAC With (nolock) ON SWAC.ActivityId = SWA.Id)
						]]>
					 </datasource>
					<datasource type="sql server">
						<![CDATA[ SWProduction SWP With (nolock) ,SWLong SWL With (nolock) ,
							(((((SWExecute SWE With (nolock) LEFT OUTER JOIN SWExecutionDetails SWED With (nolock) On SWE.ID = SWED.ExecutionID)
							LEFT OUTER JOIN SWActivityList SWA With (nolock) On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
							LEFT OUTER JOIN SWActivityTransaction SWAT With (nolock) On SWA.ID = SWAT.ActivityId AND SWAT.ExecutionDetailsId=SWA.ExecutionDetailsId AND SWAT.ActivityStatus not in ('awaiting','acknowledged','completed','information') AND SWAT.ActivityStatus is not null)
							LEFT OUTER JOIN SWAcknowledgeDetails SWAD With (nolock) On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId)
							LEFT OUTER JOIN SWActivityCustomFields SWAC With (nolock) ON SWAC.ActivityId = SWA.Id)
						]]>
					 </datasource>
					 <datasource type="oracle oledb">
						<![CDATA[ SWExecute SWE ,  SWExecutionDetails SWED ,SWActivityList SWA,
							SWActivityTransaction SWAT ,SWAcknowledgeDetails SWAD , SWActivityCustomFields SWAC, SWProduction SWP , SWLong SWL 
						]]>
					 </datasource>
					 <datasource type="access oledb">
					 	<![CDATA[ ((((((SWExecute AS SWE 
							LEFT JOIN SWExecutionDetails AS SWED ON SWE.ID = SWED.ExecutionID) 
							LEFT JOIN SWActivityList AS SWA ON (SWA.ExecutionID = SWED.ExecutionID) AND (SWED.ID = SWA.ExecutionDetailsId)) 
							LEFT JOIN SWActivityTransaction AS SWAT ON SWA.ID = SWAT.ActivityId AND (SWAT.ExecutionDetailsId=SWA.ExecutionDetailsId AND SWAT.ActivityStatus not in ('awaiting','acknowledged','completed','information') AND SWAT.ActivityStatus is not null)) 
							LEFT JOIN SWAcknowledgeDetails AS SWAD ON SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId) 
							LEFT JOIN SWActivityCustomFields SWAC ON SWAC.ActivityId = SWA.Id)
							INNER JOIN SWProduction AS SWP ON SWE.ProductionId= SWP.Id) 
							INNER JOIN SWLong AS SWL ON SWE.Data = SWL.ID 
						]]>
					 </datasource>
				</add>
				<add action="append" position="where">
					<datasource type="default">
						<![CDATA[ SWE.ProductionId= SWP.Id And SWE.Data = SWL.ID ]]>
					</datasource>
					<datasource type="sql server">
						<![CDATA[ SWE.ProductionId= SWP.Id And SWE.Data = SWL.ID ]]>
					</datasource>
					<datasource type="oracle oledb">
						<![CDATA[ (SWE.ID = SWED.ExecutionID (+) )
							AND (SWED.ID = SWA.ExecutionDetailsId (+)  AND SWA.ExecutionID (+)= SWED.ExecutionID)
							AND (SWA.ID = SWAT.ActivityId (+))
							AND (SWA.Id = SWAC.ActivityId (+))
							AND (SWA.ExecutionDetailsId = SWAD.ExecutionDetailsId(+))
							AND SWE.Data = SWL.ID  
							AND SWE.ProductionId = SWP.Id 
						]]>
					</datasource>
					<datasource type="access oledb">
						<![CDATA[ SWE.Id is not null ]]>
					</datasource>
				</add>				
				<add action="append" position="where">
					<![CDATA[ And SWE.Id In (]]>
				</add>
				<!--type is set as query when a filterquery has to be added to the parent query-->
				<add action="append" position="where" type="query" name="filtercondition">
				</add>
				<add action="append" position="where">
					<![CDATA[)]]>
				</add>
				<!--type attribute is used to distinquish between parent query and child query-->
				<query name="filtercondition" type="subquery">
					<add action="append" position="select">
						<![CDATA[ DISTINCT SWE.ID ]]>
					</add>					
					<add action="append" position="from">
						<datasource type="default">
							<![CDATA[ SWProduction SWP With (nolock), SWLong SWL With (nolock),
								(((((SWExecute SWE With (nolock) LEFT OUTER JOIN SWExecutionDetails SWED With (nolock) On SWE.ID = SWED.ExecutionID)
								LEFT OUTER JOIN SWActivityList SWA With (nolock) On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
								LEFT OUTER JOIN SWActivityTransaction SWAT With (nolock) On SWA.ID = SWAT.ActivityId)
								LEFT OUTER JOIN SWAcknowledgeDetails SWAD With (nolock) On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId) 
								LEFT OUTER JOIN SWActivityCustomFields SWAC With (nolock) ON SWAC.ActivityId = SWA.Id)
							]]>
						</datasource>
						<datasource type="sql server">
							<![CDATA[ SWProduction SWP With (nolock) , SWLong SWL With (nolock),
								(((((SWExecute SWE With (nolock) LEFT OUTER JOIN SWExecutionDetails SWED With (nolock) On SWE.ID = SWED.ExecutionID)
								LEFT OUTER JOIN SWActivityList SWA With (nolock) On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
								LEFT OUTER JOIN SWActivityTransaction SWAT With (nolock) On SWA.ID = SWAT.ActivityId)
								LEFT OUTER JOIN SWAcknowledgeDetails SWAD With (nolock) On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId) 
								LEFT OUTER JOIN SWActivityCustomFields SWAC With (nolock) ON SWAC.ActivityId = SWA.Id)
								]]>
						</datasource>
						<datasource type="oracle oledb">
							<![CDATA[ SWExecute SWE ,  SWExecutionDetails SWED ,SWActivityList SWA,
								SWActivityTransaction SWAT ,SWAcknowledgeDetails SWAD , SWActivityCustomFields SWAC, SWProduction SWP , SWLong SWL ]]>
						</datasource>
						<datasource type="access oledb">
							<![CDATA[  ((((((SWExecute AS SWE 
								LEFT JOIN SWExecutionDetails AS SWED ON SWE.ID = SWED.ExecutionID) 
								LEFT JOIN SWActivityList AS SWA ON (SWA.ExecutionID = SWED.ExecutionID) AND (SWED.ID = SWA.ExecutionDetailsId)) 
								LEFT JOIN SWActivityTransaction AS SWAT On SWA.ID = SWAT.ActivityId)
								LEFT JOIN SWAcknowledgeDetails AS SWAD ON SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId) 
								LEFT JOIN SWActivityCustomFields SWAC ON SWAC.ActivityId = SWA.Id)
								INNER JOIN SWProduction AS SWP ON SWE.ProductionId= SWP.Id) 
								INNER JOIN SWLong AS SWL ON SWE.Data = SWL.ID 
							]]>
					 	</datasource>
					</add>
					<add action="append" position="where">
						<datasource type="default">
							<![CDATA[ SWE.Data = SWL.ID  AND SWE.ProductionId = SWP.Id ]]>
						</datasource>
						<datasource type="sql server">
							<![CDATA[ SWE.Data = SWL.ID  AND SWE.ProductionId = SWP.Id ]]>
						</datasource>
						<datasource type="oracle oledb">
							<![CDATA[ (SWE.ID = SWED.ExecutionID (+) )
								AND (SWED.ID = SWA.ExecutionDetailsId (+)  AND SWA.ExecutionID (+)= SWED.ExecutionID)
								AND (SWA.ID = SWAT.ActivityId (+))
								AND (SWA.Id = SWAC.ActivityId (+))
								AND (SWA.ExecutionDetailsId = SWAD.ExecutionDetailsId(+))
								AND SWE.Data = SWL.ID  
								AND SWE.ProductionId = SWP.Id 
								]]>
						</datasource>
						<datasource type="access oledb">
							<![CDATA[ SWE.Id is not null ]]>
						</datasource>
					</add>
					<add action="append" position="fields" >
						<![CDATA[AND SWE.Application = ]]>
						<value selectvalue="application" format="string" />
					</add>
					<add action="append" position="fields" >
						<![CDATA[ AND SWE.Name in ( ]]>
					</add>
					<add action="append" position="fields" >
						<value selectvalue="workflow" format="string" valueseperator=","/>
					</add>
					<add action="append" position="fields" >
						<![CDATA[ )]]>
					</add>					
					<add action="append" position="fields" >
						<value selectvalue="reportspecificvirtualuserid"  />
					</add>
					<add action="append" position="fields" >
						<![CDATA[ AND SWE.VirtualUserId  ]]>
					</add>
					<add action="append" position="fields" >
						<value selectvalue="reportspecificsubmittedbyvirtualuserid"  />
					</add>
				</query>
			</query>
			<groupby name="Action">
				<columns width="95%">
					<column name="ExecutionDetailsId" type="string" query="SWED.Id" queryas="ExecutionDetailsId" displayas="ExecutionDetailsId" display="false" displaywidth=""></column>
					<column name="ActionName" type="string" query="SWED.ActionName" queryas="ActionName" displayas="Action Name" display="true" displaywidth="20%"></column>
					<column name="ActionType" type="string" query="SWED.ActionType" queryas="ActionType" displayas="Action Type" display="true" displaywidth="20%"></column>
					<column name="ActionStatus" type="string" query="SWED.Status" queryas="ActionStatus" displayas="Action Status" display="true" mapvaluetoqueryfield="Action Status" maptofieldinqueryfield="Action Status"></column>
					<column name="StartedOn" type="datetime" query="SWED.StartedOn" queryas="ActionDateTime" displayas="Action Started Date Time" display="true" displaywidth="20%"></column>
					<column name="ActionOutput" type="string" query="SWED.OutPut" queryas="ActionOutput" displayas="Output" display="false" displaywidth="20%"></column>
					<column name="ActionInlinkOutput" type="string" query="SWED.InlinkActionOutput" queryas="InlinkActionOutput" displayas="InlinkActionOutput" display="false" displaywidth="20%"></column>
					<column name="OnBehalfOf" type="resource" conditionbuilder="subquery" query="" queryas="" displayas="" display="false">
						<subquery name="subquery1" value="Alternate Resource Action" operator="equalto">								
							<query name="filtercondition" type="subquery">
								<!--
									The sub query option is provided, if the search query cannot be built on a particular db field.
									The positions that can be provided are "fields" or "end".
									The queryname will always be filtercondition.		
								-->
								<add action="append" position="fields">
									<![CDATA[ SWA.OnBehalfOfUser > 0]]>	
								</add>
							</query>
						</subquery>
						<subquery name="subquery2" value="Alternate Resource Action" operator="notequalto">								
							<query name="filtercondition" type="subquery">
								<add action="append" position="fields">
									<![CDATA[ CDATA[SWA.OnBehalfOfUser = 0]]>
								</add>
							</query>
						</subquery>
						<subquery name="subquery3" value="TimedOutAction" operator="equalto">								
							<query name="filtercondition" type="subquery">
								<add action="append" position="fields">
									<![CDATA[ SWA.Status in ('timeoutactivity')]]>
								</add>
							</query>
						</subquery>
						<subquery name="subquery4" value="TimedOutAction" operator="notequalto">								
							<query name="filtercondition" type="subquery">
								<add action="append" position="fields">
									<![CDATA[  SWA.Status not in ('timeoutactivity')]]>
								</add>
							</query>
						</subquery>
						<subquery name="subquery5" value="Multiple Resource Action" operator="equalto">								
							<query name="filtercondition" type="subquery">
								<add action="append" position="end">
									<![CDATA[  SWA.ExecutionDetailsId in 
									(
										Select ExecutionDetailsId FROM SWActivityList GROUP BY ExecutionDetailsId HAVING Count(ExecutionDetailsId) > 1 
									) ]]>
								</add>
							</query>
						</subquery>
						<subquery name="subquery6" value="Multiple Resource Action" operator="notequalto">								
							<query name="filtercondition" type="subquery">
								<add action="append" position="end">
									<![CDATA[ SWA.ExecutionDetailsId in 
									(
										Select ExecutionDetailsId FROM SWActivityList GROUP BY ExecutionDetailsId HAVING Count(ExecutionDetailsId) = 1
									)	
									]]>
								</add>
							</query>
						</subquery>
						<subquery name="subquery7" value="Forwarded Action" operator="equalto">								
							<query name="filtercondition" type="subquery">
								<add action="append" position="end">
									<![CDATA[
									 SWA.ExecutionDetailsId in 
									(
									Select SWAL.ExecutionDetailsId FROM SWActivityList SWAL,SWForwardActivity SWFA WHERE SWAL.ID = SWFA.ActivityId
									)	
									]]>
								</add>
							</query>
						</subquery>
						<subquery name="subquery8" value="Forwarded Action" operator="notequalto">								
							<query name="filterconditionAlternate Resource Action">
								<add action="append" position="end">
									<![CDATA[
									 SWA.ExecutionDetailsId not in 
									(
									Select SWAL.ExecutionDetailsId FROM SWActivityList SWAL,SWForwardActivity SWFA WHERE SWAL.ID = SWFA.ActivityId
									)	
									]]>
								</add>
							</query>
						</subquery>
					</column>
				</columns>
				<breakonfield fieldname="ExecutionDetailsId"/>
				<!--<query name="outputquery" >
					<add action="append" position="where">
						<![CDATA[ AND SWE.ID = SWED.ExecutionId AND SWED.Id = SWA.ExecutionDetailsId]]>
					</add>
					<query name="filtercondition" type="subquery">
						<add action="append" position="from">
							<![CDATA[ , SWExecutionDetails SWED , SWActivityList SWA]]>
						</add>
						<add action="append" position="where">
							<![CDATA[ AND SWE.ID = SWED.ExecutionId AND SWED.Id = SWA.ExecutionDetailsId]]>
						</add>
					</query>
				</query>-->
				<groupby name="Resource">
					<columns width="95%">
						<column name="ActivityId" type="identifier" query="SWA.Id" queryas="ActivityId" displayas="ActivityId" display="true" displaywidth="15%"></column>
						<column name="AssignedTo" type="resource" query="SWA.VirtualUserid" queryas="SubmittedTo" displayas="Assigned To" display="true" displaywidth="20%"></column>
						<column name="AssignedOn" type="datetime" query="SWA.AssignedOn" queryas="AssignedOnDateTime" displayas="Assigned On" display="true" displaywidth="18%"></column>
						<column name="ExecutionDetailsId" type="string" query="SWA.ExecutionDetailsId" queryas="ActivityExecutionDetailsId" displayas="" display="false" displaywidth="18%"></column>
						<column name="Status" type="string" query="SWA.Status" queryas="ActivityStatus" displayas="Activity Status" display="true" displaywidth="18%"></column>
						<column name="ActivityStatus" type="string" query="SWAT.ActivityStatus" queryas="ActivityTransactStatus" displayas="Resource Output" display="true" displaywidth="18%"></column>
						<!--Since the columns are internally mapped the query tag should be provided only with the SWActivityCustomFields table table alias name
						If displayas is not set then the field added wat design  time will be considered
						<column name="Customfield"  type="customfield" queryas="Testing1" display="true" cansort="true" displaywidth="15%"></column>-->
					</columns>
					<breakonfield fieldname="ActivityId"/>
					<query name="outputquery" >
						<add action="append" position="select">
							<![CDATA[ ,SWAT.Id as TransactId ]]>
						</add>
						<add action="append" position="end">
							<![CDATA[ Order by SWE.ID , SWED.Id , SWA.Id ,SWAT.Id Desc ]]>
						</add>
						<!--<query name="filtercondition" type="subquery">
							<add action="append" position="from">
								<![CDATA[ , SWActivityTransaction SWAT]]>
							</add>
							<add action="append" position="where">
								<![CDATA[ AND SWAT.ActivityId = SWA.ID AND SWAT.ExecutionDetailsId = SWA.ExecutionDetailsId]]>
							</add>								
						</query>-->
					</query>
				</groupby>
			</groupby>
		</groupby>
	</outputfields>
	<queryfields name="Workflow" >
		<!--
			queryfield is used to identify the column on which the search has to be done.
			It has to be a field that comes under the groupbyname specified for the queryfield.
			If workflow is selected in query builder then the search query will be  
			SWE.Name  = 'Default'. 
		-->
		<queryfield name="WorkflowName" groupbyname="Workflow"/>
		<operators operatornames="equalto,contains,notequalto" />			
		<fields>			
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false"></value>
			</field>
			<field display="Workflow" value="Workflow">
				<value type="query" displaytype="dropdown" fromdb="true" >
					<query>
						<add action="append" position="select">
							<![CDATA[DISTINCT SP.Name as SelectDisplay,SP.Name as SelectValue]]>
						</add>
						<add action="append" position="from">
							<![CDATA[SWProduction SP]]>
						</add>
						<add action="append" position="where">
							<![CDATA[SP.Name is not null]]>
						</add>
						<add action="append" position="fields">
							<![CDATA[ AND SP.Name In (<bookmark name="replacemarker"/>)]]>
						</add>
						<add action="replace" position="replacemarker" type="bookmark">
							<value selectvalue="workflow" format="string" valueseperator=","/>
						</add>
						<add action="append" position="end">
							<![CDATA[ Order by SP.Name ]]>
						</add>
						 <!--<add action="append" position="fields">
							<foreachvalue name="Workflow" valueseperator=",">
								<![CDATA[AND SP.Name Like]]>
								<value selectvalue="workflow" format="string" />								
							</foreachvalue>
						</add>-->
					</query>						
				</value>
			</field>
		</fields>
		<outfields>
			<showfields fields=""/>
			<hidefields fields=""/>
		</outfields>
	</queryfields>
	<queryfields name="Version" >
		<queryfield name="Version" groupbyname="Workflow" />
		<operators operatornames="equalto,greaterthan,lessthan,greaterthanandequalto,lessthanandequalto,notequalto" />
		<fields>
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false" displaystring="If value entered in text is 0 then latest version for the workflow will be considered.">					
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Workflow Internal Status" >
		<queryfield name="InternalStatus" groupbyname="Workflow" />
		<operators operatornames="in,notin" />
		<fields>
			<field display="Status" value="InternalStatus">
				<value type="rows" displaytype="dropdown" fromdb="false" valueseperator=",">
					<row display="Current Running Workflows" value="EX,SL" />
					<row display="Execution Pending" value="EP" />
					<row display="Execution in Progress" value="EX" />
					<row uidisplay="Waiting for user input" display="Waiting for user input" value="SL" />
					<row display="Workflow Execution Finished Successfully" value="FN" />
					<row display="Workflow Execution Finished with Errors" value="FE" />
					<row display="Workflow was aborted half way through" value="AB" />
					<row display="Workflow was Paused" value="PA" />
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Workflow User Maintained Status" >
		<queryfield name="Status" groupbyname="Workflow" />
		<operators operatornames="equalto,notequalto" />			
		<fields>
			<field display="Status" value="userStatus">
				<value type="rows" displaytype="dropdown" fromdb="false">
					<row display="Testing Workflows" value="testing" />
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Submitted By" groupbyname="Workflow">
		<queryfield name="VirtualUserid" groupbyname="Workflow"/>
		<operators operatornames="in,notin,equalto,notequalto" />
		<fields>
			<field display="Resource" value="Resource">
				<value type="resource" displaytype="resource" fromdb="false"></value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Content Data" >
		<queryfield name="CharData" groupbyname="Workflow" />
		<operators operatornames="contains" />	
		<fields>
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false" />
			</field>
		</fields>
	</queryfields>
	<!--Sub query used here-->
	<queryfields name="Workflow Executed Date Time" >
		<queryfield name="RequestedOn" groupbyname="Workflow" />
		<operators operatornames="equalto,notequalto,greaterthan,lessthan,greaterthanandequalto,lessthanandequalto" />			
		<fields>
			<field display="Date Time" value="DateTime">
				<value type="datetime" displaytype="datetime" fromdb="false" displaystring="MM/DD/YYYY">					
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Action Name" >
		<queryfield name="ActionName" groupbyname="Action"/>
		<operators operatornames="equalto,notequalto,contains" />
		<fields>
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false" />
			</field>
			<field display="Actions" value="ActionName">
				<value type="query" displaytype="dropdown" fromdb="true">
					 <query>
						<add action="append" position="select">
							<![CDATA[DISTINCT SWED.ActionName as SelectDisplay,SWED.ActionName as SelectValue]]>
						</add>
						<add action="append" position="from">
							<![CDATA[SWExecute SWE ,SWExecutionDetails SWED]]>
						</add>
						<add action="append" position="where">
							<![CDATA[SWE.ID = SWED.ExecutionId]]>
						</add>
						 <!--<add action="append" position="fields">
							<foreachvalue name="Workflow" valueseperator=",">
								<![CDATA[AND SWE.Name Like]]>
								<value selectvalue="workflow" format="string" />								
							</foreachvalue>
						</add>-->
						 <add action="append" position="fields" >
							<![CDATA[AND SWE.Application =  ]]>
							<value selectvalue="application" format="string" />
						</add>
						<add action="append" position="fields">
							<![CDATA[AND SWE.Name In (<bookmark name="replacemarker"/>)]]>
						</add>
						<add action="replace" position="replacemarker" type="bookmark">
							<value selectvalue="workflow" format="string" valueseperator=","/>
						</add>
						<add action="append" position="end">
							<![CDATA[ Order by SWED.ActionName ]]>
						</add>
					 </query>
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Action Type" >
		<queryfield name="ActionType" groupbyname="Action"/>
		<operators operatornames="equalto,notequalto,contains" />			
		<fields>
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false" />
			</field>
			<field display="Actions" value="ActionName">
				<value type="query" displaytype="dropdown"  fromdb="true">
					<query>
						<add action="append" position="select">
							<![CDATA[DISTINCT SWED.ActionType as SelectDisplay,SWED.ActionType as SelectValue]]>
						</add>
						<add action="append" position="from">
							<![CDATA[SWExecute SWE ,SWExecutionDetails SWED]]>
						</add>
						<add action="append" position="where">
							<![CDATA[SWE.ID = SWED.ExecutionId AND SWED.ActionType is not null]]>
						</add>
						<add action="append" position="fields" >
							<![CDATA[ AND SWE.Application =  ]]>
							<value selectvalue="application" format="string" />
						</add>
						<add action="append" position="fields">
							<![CDATA[ AND SWE.Name In (<bookmark name="replacemarker"/>) ]]>
						</add>
						<add action="replace" position="replacemarker" type="bookmark">
							<value selectvalue="workflow" format="string" valueseperator=","/>
						</add>
						<add action="append" position="end">
							<![CDATA[ Order by SWED.ActionType ]]>
						</add>
					</query>						
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Action Status" >
		<queryfield name="ActionStatus" groupbyname="Action"/>
		<operators operatornames="in,notin" />			
		<fields>
			<field display="Action Status" value="ActionStatus">
				<value type="rows" displaytype="dropdown" fromdb="false" valueseperator=",">
					<row display="Current Executing Actions" value="E,S" />
					<row display="Sleeping Action" value="S" />
					<row display="Inserted Action" value="P" />
					<row display="Executing Action" value="E" />
					<row display="Completed Action" value="C" />		
					<row display="Action Completed and next instantiaited" value="Z" />
					<row display="Action Killed" value="K" />
					<row display="Action Paused" value="U" />
				</value>
			</field>
		</fields>
	</queryfields>
	<!--Sub query is used in this scenario-->
	<queryfields name="Action Activity Status" >
		<queryfield name="OnBehalfOf" groupbyname="Action"/>
		<operators operatornames="equalto,notequalto" />			
		<fields>
			<field display="Activity Status" value="ActivityStatus">
				<value type="rows" displaytype="dropdown" fromdb="false">
					<row display="Forwarded Action" value="Forwarded Action" />
					<row display="TimedOutAction" value="TimedOutAction" />
					<row display="Multiple Resource Action" value="Multiple Resource Action" />
					<row display="Alternate Resource Action" value="Alternate Resource Action" />					
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Action Executed From Output" >
		<queryfield name="ActionInlinkOutput" groupbyname="Action"/>
		<operators operatornames="equalto,notequalto,contains" />			
		<fields>
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false" />
			</field>
		</fields>
	</queryfields>
	<queryfields name="Action Executed with Output">
		<queryfield name="ActionOutput" groupbyname="Action"/>
		<operators operatornames="equalto,notequalto,contains" />			
		<fields>
			<field display="Value" value="Value">
				<value type="text" displaytype="text" fromdb="false" />
			</field>
		</fields>
	</queryfields>
	<queryfields name="Resource Activity Status" >
		<queryfield name="Status" groupbyname="Resource"/>
		<operators operatornames="in,notin" />			
		<fields>
			<field display="Approval Status" value="ApprovalStatus">
				<value type="rows" displaytype="dropdown" fromdb="false">					
					<row display="Action pending for resource action" value="awaiting" />
					<row display="Action acknowledged by resource" value="acknowledged" />
					<row display="Approved by resource" value="approved" />
					<row display="Rejected by resource" value="rejected" />
					<row display="nonacknowledgers" value="nonacknowledgers" />
					<row display="nonacknowledgers" value="decisionbeforeallresourcestookpart" />
					<row display="timeoutactivity" value="timeoutactivity" />					
				</value>
			</field>
			<field display="Checklist Status" value="ChecklistStatus">
				<value type="rows" displaytype="dropdown" fromdb="false">
					<row display="awaiting" value="awaiting" />
					<row display="acknowledged" value="acknowledged" />
					<row display="completed" value="completed" />
				</value>
			</field>
		</fields>
	</queryfields>
	<queryfields name="Resource Status" >
		<queryfield name="ActivityStatus" groupbyname="Resource"/>
		<operators operatornames="in,notin" />
		<fields>
			<field display="Approval Status" value="ResourceApprovalStatus">
				<value type="rows" displaytype="dropdown" fromdb="false">
					<row display="awaiting" value="awaiting" />
					<row display="acknowledged" value="acknowledged" />
					<row display="approved" value="approved" />
					<row display="rejected" value="rejected" />
				</value>
			</field>
			<field display="Checklist Status" value="ResourceChecklistStatus">
				<value type="rows" displaytype="dropdown" fromdb="false">
					<row display="awaiting" value="awaiting" />
					<row display="acknowledged" value="acknowledged" />
					<row display="testing1" value="testing1" />
					<row display="testing2" value="testing2" />
					<row display="completed" value="completed" />
				</value>
			</field>
		</fields>
		<outfields>
			<showfields fields=""/>
			<hidefields fields=""/>
		</outfields>
	</queryfields>
	<!--Query used to get the Total Record count -->
	<pagingquery>
		<query name="pagingquery">
			<add action="append" position="select">
				<datasource type="default">
					<![CDATA[ Count(DISTINCT SWE.ID) ]]>
				</datasource>
				<datasource type="sql server">
					<![CDATA[ Count(DISTINCT SWE.ID) ]]>
				</datasource>
				<datasource type="oracle oledb">
					<![CDATA[ Count(DISTINCT SWE.ID) ]]>
				</datasource>
				<datasource type="access oledb">
					<![CDATA[ count(S.TotalCount)
					FROM [ SELECT Distinct SWE.ID as TotalCount 
					]]>
				</datasource>
			</add>
			<add action="append" position="from">
				<datasource type="default">
					<![CDATA[ 
						(((((((SWExecute SWE With (nolock) LEFT OUTER JOIN SWExecutionDetails SWED With (nolock) On SWE.ID = SWED.ExecutionID)
						LEFT OUTER JOIN SWActivityList SWA With (nolock) On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
						LEFT OUTER JOIN SWActivityTransaction SWAT With (nolock) On SWA.ID = SWAT.ActivityId)
						LEFT OUTER JOIN SWAcknowledgeDetails SWAD With (nolock) On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId) 
						LEFT OUTER JOIN SWActivityCustomFields SWAC With (nolock) ON SWAC.ActivityId = SWA.Id)
						LEFT OUTER JOIN SWProduction SWP With (nolock) on SWE.ProductionId = SWP.Id)
						LEFT OUTER JOIN SWLONG SWL With (nolock) on SWE.Data = SWL.ID)  
					]]>
				</datasource>
				<datasource type="sql server">
					<![CDATA[ 
						(((((((SWExecute SWE With (nolock) LEFT OUTER JOIN SWExecutionDetails SWED With (nolock)  On SWE.ID = SWED.ExecutionID)
						LEFT OUTER JOIN SWActivityList SWA With (nolock) On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
						LEFT OUTER JOIN SWActivityTransaction SWAT With (nolock)  On SWA.ID = SWAT.ActivityId)
						LEFT OUTER JOIN SWAcknowledgeDetails SWAD With (nolock) On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId)
						LEFT OUTER JOIN SWActivityCustomFields SWAC With (nolock) ON SWAC.ActivityId = SWA.Id)
						LEFT OUTER JOIN SWProduction SWP  With (nolock) on SWE.ProductionId = SWP.Id)
						LEFT OUTER JOIN SWLONG SWL With (nolock) on SWE.Data = SWL.ID)    
					]]>
				</datasource>
				<datasource type="oracle oledb">
					<![CDATA[ SWExecute SWE ,SWExecutionDetails SWED ,SWActivityList SWA,
						SWActivityTransaction SWAT ,SWAcknowledgeDetails SWAD ,SWActivityCustomFields SWAC,  SWProduction SWP  ]]>
				</datasource>
				<datasource type="access oledb">
					<![CDATA[ (((((((SWExecute SWE
					LEFT OUTER Join SWExecutionDetails SWED On SWE.ID = SWED.ExecutionID)
					LEFT OUTER Join SWActivityList SWA On SWED.ID = SWA.ExecutionDetailsId AND SWA.ExecutionID = SWED.ExecutionID)
					LEFT OUTER Join SWActivityTransaction SWAT On SWA.ID = SWAT.ActivityId)
					LEFT OUTER Join SWAcknowledgeDetails SWAD On SWAD.ExecutionDetailsId = SWA.ExecutionDetailsId)
					LEFT OUTER JOIN SWActivityCustomFields SWAC ON SWAC.ActivityId = SWA.Id)
					LEFT OUTER Join SWProduction SWP On SWE.ProductionId = SWP.Id)
					LEFT OUTER JOIN SWLONG SWL on SWE.Data = SWL.ID)  
					 ]]>
				</datasource>
			</add>
			<add action="append" position="where">
				<datasource type="default">
					<![CDATA[SWE.ID is not null]]>
				</datasource>
				<datasource type="sql server">
					<![CDATA[SWE.ID is not null]]>
				</datasource>
				<datasource type="oracle oledb">
					<![CDATA[ 	(SWE.ID (+) = SWED.ExecutionID )
							AND (SWED.ID (+) = SWA.ExecutionDetailsId   AND SWA.ExecutionID = SWED.ExecutionID (+))
							AND (SWA.ID (+) = SWAT.ActivityId )
							AND (SWA.Id = SWAC.ActivityId (+))
							AND (SWA.ExecutionDetailsId = SWAD.ExecutionDetailsId (+))
							AND (SWE.ProductionId = SWP.Id (+) ) ]]>
				</datasource>
				<datasource type="access oledb">
					<![CDATA[ SWE.ID is not null]]>
				</datasource>				
			</add>
			<add action="append" position="fields" >
				<![CDATA[AND SWE.Application = ]]>
				<value selectvalue="application" format="string" />
			</add>
			<add action="append" position="fields" >
				<![CDATA[ AND SWE.Name in ( ]]>
			</add>
			<add action="append" position="fields" >
				<value selectvalue="workflow" format="string" valueseperator=","/>
			</add>
			<add action="append" position="fields" >
				<datasource type="default">
					<![CDATA[ ) ]]>
				</datasource>
				<datasource type="access oledb">
					<![CDATA[ )]]>
				</datasource>				
			</add>			
			<add action="append" position="fields" >
				<value selectvalue="reportspecificvirtualuserid"  />
			</add>
			<add action="append" position="fields" >
				<![CDATA[ AND SWE.VirtualUserId  ]]>
			</add>
			<add action="append" position="fields" >
				<value selectvalue="reportspecificsubmittedbyvirtualuserid"  />
			</add>
			<!--Query condition build from query builder gets appended automatically here-->
			<add action="append" position="end" >
				<datasource type="access oledb">
					<![CDATA[  ]. AS S ]]>
				</datasource>	
			</add>
		</query>
	</pagingquery>
</workflow.netreport>